package com.ruoyi.system.api.factory;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.RemoteBuildingService;
import com.ruoyi.system.api.domain.RemoteParkBuilding;
import feign.hystrix.FallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * 日志服务降级处理
 *
 * @author ruoyi
 */
@Component
public class RemoteBuildingFallbackFactory implements FallbackFactory<RemoteBuildingService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteBuildingFallbackFactory.class);

    @Override
    public RemoteBuildingService create(Throwable throwable) {
        log.error("日志服务调用失败:{}", throwable.getMessage());
        return new RemoteBuildingService() {

            /**
             * 根据parkCode及楼栋code查询
             *
             * @param parkCode
             * @param buildingCode
             * @return 结果
             */
            @Override
            public R<RemoteParkBuilding> getParkBuilding(String parkCode, String buildingCode) {
                return null;
            }
        };

    }
}
